Please download all data and save them to the corresponding file paths. "co-est2022-alldata.dta," "county level case and death.dta," and "merged data - weekly disease Google mobility Delphi.dta" are the foundational data for the final merged dataset, resulting in "062024_combineddata.dta." After merging the data, use "ARDL_model.do" to run the first part of the formal code after tidying the data. This code selects the most suitable lag combination for the ARDL model, resulting in "070724_minimum_mse_results_48.xlsx." The coefficients from the results are organized into the table "070624_coefficientforARDLtoIDL_48.xlsx." Also, obtain the over-impact results from the nlcom results and organize them into... Then, use the code "ARDL_to_IDL.py" to convert the ARDL model coefficients into IDL model coefficients. These coefficients are organized to produce the results table "070724_IDL_equations_results_rearrange_48.xlsx." Then, use the code "plot erlang fit_48.R" to fit the IDL model results to the Erlang distribution and display the best fit, obtaining the corresponding k and λ. Combined with these results, the table "070824_for plotting impact k and λ_48.xlsx" is produced. Using the first part of the code "unconstrained IDL.do," run xtreg to obtain within r-squared. Using the second part of the code, the results of the unconstrained model are obtained. At this point, the results in Table 1, Figures 2, 3, and 5 are all obtained. Running the code "plot erlang fit_48.R" produces the results in Figure 4. The results in Appendixes 1-3 are also obtained.

Appendix
Appendix 4:
Download the compressed file with_vacc and unzip it.
First, use the add_vacc.do code to merge the data using the basic database final_combineddata.dta. Then, use xtdpdgmm to run the ARDL model (using the data 082525_combined_with_vax.dta). The best lags of dep and indep are calculated using the best lags of combination when vacc is not used as the control variable. Also, use nlcom(use this dataset: 082525_combined_with_vax_phase2) to calculate the overall impact (stored in 082925_ARDL_coef_to Translate to IDL_summary_withoverallimpact.csv). Then, use xtreg to calculate the within r-squared using the gen pred_mob_d method (stored in 082925_xtreg within rsquare.xlsx).

Compile the coefficients of the independent and dependent variables from the xtdpdpgmm regression results and save them in 082925_ARDL_coef_to Translate to In IDL_summary_clean.xlsx, use the first section of the code 082825_ARDLtoIDL_toErlangFit.ipynb to convert the ARDL model into an IDL model (stored in 083025_IDL_equations_results_48.xlsx). Arrange the coefficients from period t-1 to period t-27, and then use the method =ABS(B2)/SUMPRODUCT(ABS($B2:$AB2)) to calculate the percentage of the corresponding period coefficient to the sum of the absolute values ​​of all coefficients to organize the results into the form of sheet 3 in 083025_final_equations_results_rearrange.xlsx. Then use the code 083025_IDLtofitErlang.R to fit the results of sheet 3 to the Erlang distribution to obtain the best fit k and delay. length (output stored in 083025_minimum_mse_results_fitingErlang.xlsx); all data are organized and stored in Table1forComparison_083025.xlsx.

appendix 5:
Run the unconstrained IDL model using the code "constrained_IDL.do" to obtain the results of the constrained model. These results are organized into the table "100724_ARDL_con_uncon_coefficient_rearrange_48.xlsx." Use the code "statesIDL Distribution.R" to obtain the results in Appendix 5.